package org.swift.mashup.engine.concurrency.memory;

import java.util.Collection;
import java.util.Collections;

import org.swift.commons.xml.XmlUtils;
import org.w3c.dom.Node;

public class W3CMemoryItem extends MemoryItem {

	private final Node node;
	
	//protected use MemoryItem.newMemoryItem
	protected W3CMemoryItem(int id, Node item, MemoryType type) {
		super(id, type);
		this.node = item;
	}

	@Override
	public Object getValue() {
		return node;
	}

	@Override
	public Collection<Node> toCollection() {
		return Collections.singletonList(node);
	}
	
	@Override
	public Node toNode() {
		return node;
	}

	@Override
	public String toString() {
		return XmlUtils.toString(node);
	}

	@Override
	public String toXML() {
		return XmlUtils.toString(node);
	}

}
